package plsqlfs;

import java.sql.SQLData;
import java.sql.SQLException;
import java.sql.SQLInput;
import java.sql.SQLOutput;

/**
 * A class for transferring instances of the Oracle type FS_FILE_HANDLE_TYPE to and from the Java stored procedure.
 * 
 * @author Adam Paynter
 *
 */
public class FileHandle implements SQLData {

	private String sqlTypeName;
	private int id;

	public FileHandle() {
		
	}

	public FileHandle(int id) {
		this.id = id;
	}

	public FileHandle(String sqlTypeName, int id) {
		this.sqlTypeName = sqlTypeName;
		this.id = id;
	}

	public String getSQLTypeName() throws SQLException {
		return sqlTypeName;
	}

	public void setSQLTypeName(String sqlTypeName) {
		this.sqlTypeName = sqlTypeName;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void readSQL(SQLInput stream, String sqlTypeName) throws SQLException {
		this.sqlTypeName = sqlTypeName;
		id = stream.readInt();
	}

	public void writeSQL(SQLOutput stream) throws SQLException {
		stream.writeInt(id);
	}

}
